Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
q3-core-responder
Advanced tools
Q3 responder handles two responsibilities: (1) assigning HTTP status codes to unhandled exceptions and (2) throwing custom errors in the stack. Within client projects, the first is irrelevant as Q3 registers the functionality via global express middle
Q3 responder handles two responsibilities: (1) assigning HTTP status codes to unhandled exceptions and (2) throwing custom errors in the stack. Within client projects, the first is irrelevant as Q3 registers the functionality via global express middleware. However, the second is very common when dealing with custom validation logic.
exception
The exception
export offers a chainable API for building
general and field-level errors. When constructing, the first
parameter will correspond to an HTTP status code (see table
below).
Error | Code |
---|---|
BadRequest | 400 |
Authentication | 401 |
Authorization | 403 |
ResourceNotFound | 404 |
Conflict | 409 |
Gone | 410 |
Preprocessing | 412 |
Validation | 422 |
InternalServer | 500 |
Afterwards, you can chain the following methods. You can
invoke msg
and field
in any order but boomerang
, log
and throw
should end your chain.
Method | Param | Description |
---|---|---|
msg | String | The language key for a message to decorate the HTTP response |
field | String or Object | The field-level error to report. If a string, it will duplicate the msg output. If an object, you can provide custom messages and map to multiple fields. |
throw | A custom error will throw in your stack | |
boomerang | A custom error will return | |
log | A custom error will log to console |
const { exception } = require('q3-core-responder');
function doSomething(args = {}) {
if (args.bad)
exception('Conflict')
.msg('custom18nMessageKey')
.field('name')
.throw();
if (args.reallyBad)
exception('Validation')
.msg('custom18nMessageKey')
.field({
in: 'application', // can be anything
name: ['field1', 'field2'],
msg: 'dataNoGood',
})
.throw();
}
FAQs
Q3 responder handles two responsibilities: (1) assigning HTTP status codes to unhandled exceptions and (2) throwing custom errors in the stack. Within client projects, the first is irrelevant as Q3 registers the functionality via global express middle
The npm package q3-core-responder receives a total of 30 weekly downloads. As such, q3-core-responder popularity was classified as not popular.
We found that q3-core-responder demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.